import axios from '@/utils/axios'

export const getDemo = (id: string): Promise<ApiResult<Demo>> => {
    return axios.get(`demo/${id}`)
}

export const getDemoPage = (pagination: Pagination, params: Demo): Promise<ApiResult<Page<Demo>>> => {
    return axios.get(`demo/page/${pagination.page}/${pagination.pageSize}`, { params })
}

export const postOrPutDemo = (data: Demo): Promise<ApiResult<null>> => {
    return axios.post(`demo`, data)
}

export const deleteDemo = (id: string): Promise<ApiResult<null>> => {
    return axios.delete(`demo/${id}`)
}

export const deleteDemoList = (ids: URLSearchParams): Promise<ApiResult<null>> => {
    return axios.delete(`demo/list`, { params: ids })
}